home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / LocationManager.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  10.9 KB  |  354 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        LocationManager.a
  3. ;
  4. ;    Contains:    LocationManager (manages groups of settings)
  5. ;
  6. ;    Version:    Technology:    Mac OS 8
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__LOCATIONMANAGER__') = 'UNDEFINED' THEN
  18. __LOCATIONMANAGER__ SET 1
  19.  
  20.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  21.     include 'AppleEvents.a'
  22.     ENDIF
  23.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  24.     include 'Components.a'
  25.     ENDIF
  26.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  27.     include 'Dialogs.a'
  28.     ENDIF
  29.     IF &TYPE('__PROCESSES__') = 'UNDEFINED' THEN
  30.     include 'Processes.a'
  31.     ENDIF
  32.     IF &TYPE('__STANDARDFILE__') = 'UNDEFINED' THEN
  33.     include 'StandardFile.a'
  34.     ENDIF
  35.  
  36. ;  Location Manager API Support -------------------------------------------------------------------- 
  37. ;  A Location Token uniquely identifies a Location on a machine... 
  38.  
  39.  
  40.  
  41.  
  42. kALMNoLocationToken                EQU        -1                    ; ALMToken of "off" Location...
  43.  
  44. kALMLocationNameMaxLen            EQU        31                    ; name (actually imposed by file system)... 
  45. kALMNoLocationIndex                EQU        -1                    ; index for the "off" Location (kALMNoLocationToken)... 
  46. ALMLocationName            RECORD 0
  47. f                         ds        Str31
  48. sizeof                     EQU *                    ; size:   $20 (32)
  49.                         ENDR
  50.  
  51.  
  52. ;  Returned from ALMConfirmName... 
  53. ; typedef SInt16                         ALMConfirmChoice
  54.  
  55.  
  56. kALMConfirmRename                EQU        1
  57. kALMConfirmReplace                EQU        2
  58. ;  ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)... 
  59.  
  60.  
  61. kALMDuplicateRenameButton        EQU        1                    ; if Window refcon is kALMDuplicateDialogRefCon... 
  62. kALMDuplicateReplaceButton        EQU        2
  63. kALMDuplicateCancelButton        EQU        3
  64. kALMDuplicatePromptText            EQU        5
  65.  
  66. kALMRenameRenameButton            EQU        1                    ; if Window refcon is kALMRenameDialogRefCon... 
  67. kALMRenameCancelButton            EQU        2
  68. kALMRenameEditText                EQU        3
  69. kALMRenamePromptText            EQU        4
  70. ;  Refcons of two windows in ALMConfirmName (ALM 2.0)... 
  71.  
  72.  
  73. kALMDuplicateDialogRefCon        EQU        'dupl'
  74. kALMRenameDialogRefCon            EQU        'rnam'
  75. ;  Callback routine for Location awareness (mimics AppleEvents) in non-application code... 
  76.  
  77. ;  Notification AppleEvents sent to apps/registered code...  
  78.  
  79. kAELocationChangedNoticeKey        EQU        'walk'                ; Current Location changed... 
  80. kAELocationRescanNoticeKey        EQU        'trip'                ; Location created/renamed/deleted... 
  81. ;  ALMSwitchToLocation masks... 
  82.  
  83. ; typedef SInt32                         ALMSwitchActionFlags
  84.  
  85.  
  86. kALMDefaultSwitchFlags            EQU        $00000000            ; No special action to take... 
  87. kALMDontShowStatusWindow        EQU        $00000001            ; Suppress "switching" window... 
  88. kALMSignalViaAE                    EQU        $00000002            ; Switch by sending Finder AppleEvent... 
  89. ;  Parameters for Get/Put/Merge Location calls... 
  90.  
  91. ; typedef const OSType *                ConstALMModuleTypeListPtr
  92.  
  93.  
  94. kALMAddAllOnSimple                EQU        0                    ; Add all single-instance, non-action modules... 
  95. kALMAddAllOff                    EQU        -1                    ; Add all modules but turn them off... 
  96. ;  Item numbers for use in Get/Put/Merge Location filters... 
  97.  
  98.  
  99. kALMLocationSelectButton        EQU        1
  100. kALMLocationCancelButton        EQU        2
  101. kALMLocationBalloonHelp            EQU        3
  102. kALMLocationLocationList        EQU        7
  103. kALMLocationLocationNameEdit    EQU        10
  104. kALMLocationPromptText            EQU        11
  105.  
  106. kALMLocationSaveButton            EQU        1
  107. ;  Location Manager Module API Support ------------------------------------------------------------- 
  108.  
  109. ;  ALMGetScriptInfo stuff... 
  110.  
  111.  
  112. kALMScriptInfoVersion            EQU        2                    ; Customarily put in resource for localization... 
  113. ALMScriptManagerInfo    RECORD 0
  114. version                     ds.w    1                ; offset: $0 (0)        ;  Set to kALMScriptInfoVersion... 
  115. scriptCode                 ds.w    1                ; offset: $2 (2)
  116. regionCode                 ds.w    1                ; offset: $4 (4)
  117. langCode                 ds.w    1                ; offset: $6 (6)
  118. fontNum                     ds.w    1                ; offset: $8 (8)
  119. fontSize                 ds.w    1                ; offset: $A (10)
  120. sizeof                     EQU *                    ; size:   $C (12)
  121.                         ENDR
  122. ; typedef struct ALMScriptManagerInfo *    ALMScriptManagerInfoPtr
  123.  
  124.  
  125. ;   Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  126. ;   samples and internally, so....
  127.  
  128.  
  129. ALMAltScriptManagerInfo    RECORD 0
  130. version                     ds.w    1                ; offset: $0 (0)
  131. scriptCode                 ds.w    1                ; offset: $2 (2)
  132. regionCode                 ds.w    1                ; offset: $4 (4)
  133. langCode                 ds.w    1                ; offset: $6 (6)
  134. fontSize                 ds.w    1                ; offset: $8 (8)
  135. fontName                 ds        Str63            ; offset: $A (10)
  136. sizeof                     EQU *                    ; size:   $4A (74)
  137.                         ENDR
  138. ; typedef struct ALMAltScriptManagerInfo * ALMAltScriptManagerInfoPtr
  139.  
  140. ; typedef ALMAltScriptManagerInfoPtr *    ALMAltScriptManagerInfoHandle
  141.  
  142.  
  143. kALMAltScriptManagerInfoRsrcType EQU    'trip'
  144. kALMAltScriptManagerInfoRsrcID    EQU        0
  145. ;  Reboot information used on ALMSetCurrent (input/output parameter)... 
  146.  
  147. ; typedef UInt32                         ALMRebootFlags
  148.  
  149.  
  150. kALMNoChange                    EQU        0
  151. kALMAvailableNow                EQU        1
  152. kALMFinderRestart                EQU        2
  153. kALMProcesses                    EQU        3
  154. kALMExtensions                    EQU        4
  155. kALMWarmBoot                    EQU        5
  156. kALMColdBoot                    EQU        6
  157. kALMShutdown                    EQU        7
  158.  
  159. ;   File types and signatures...
  160. ;   Note: auto-routing of modules will not be supported for 'thng' files...
  161.  
  162.  
  163.  
  164.  
  165. kALMFileCreator                    EQU        'fall'                ; Creator of Location Manager files... 
  166. kALMComponentModuleFileType        EQU        'thng'                ; Type of a Component Manager Module file [v1.0]... 
  167. kALMComponentStateModuleFileType EQU    'almn'                ; Type of a CM 'state' Module file... 
  168. kALMComponentActionModuleFileType EQU    'almb'                ; Type of a CM 'action' Module file... 
  169. kALMCFMStateModuleFileType        EQU        'almm'                ; Type of a CFM 'state' Module file... 
  170. kALMCFMActionModuleFileType        EQU        'alma'                ; Type of a CFM 'action' Module file... 
  171. ;  Component Manager 'thng' info... 
  172.  
  173.  
  174. kALMComponentRsrcType            EQU        'thng'
  175. kALMComponentType                EQU        'walk'
  176. ;  CFM Modules require a bit of information (replacing some of the 'thng' resource)... 
  177.  
  178.  
  179. kALMModuleInfoRsrcType            EQU        'walk'
  180. kALMModuleInfoOriginalVersion    EQU        0
  181. ;  These masks apply to the "Flags" field in the 'thng' or 'walk' resource... 
  182.  
  183.  
  184. kALMMultiplePerLocation            EQU        $00000001            ; Module can be added more than once to a Location... 
  185. kALMDescriptionGetsStale        EQU        $00000002            ; Descriptions may change though the setting didn't...  
  186. ;  Misc stuff for older implementations ------------------------------------------------------------ 
  187.  
  188.     IF OLDROUTINENAMES THEN
  189. ;  Old error codes for compatibility - new names are in Errors interface... 
  190.  
  191. ALMInternalErr                    EQU        -30049                ; use kALMInternalErr 
  192. ALMLocationNotFound                EQU        -30048                ; use kALMLocationNotFoundErr 
  193. ALMNoSuchModuleErr                EQU        -30047                ; use kALMNoSuchModuleErr 
  194. ALMModuleCommunicationErr        EQU        -30046                ; use kALMModuleCommunicationErr 
  195. ALMDuplicateModuleErr            EQU        -30045                ; use kALMDuplicateModuleErr 
  196. ALMInstallationErr                EQU        -30044                ; use kALMInstallationErr 
  197. ALMDeferSwitchErr                EQU        -30043                ; use kALMDeferSwitchErr 
  198. ;  Old ALMConfirmName constants... 
  199.  
  200.  
  201. ALMConfirmRenameConfig            EQU        1
  202. ALMConfirmReplaceConfig            EQU        2
  203. ;  Old AppleEvents... 
  204.  
  205.  
  206. kAELocationNotice                EQU        'walk'
  207. ALMScriptMgrInfo        RECORD 0
  208. f                         ds        ALMScriptManagerInfo
  209. sizeof                     EQU *                    ; size:   $C (12)
  210.                         ENDR
  211.  
  212.  
  213. ; typedef UInt32                         ALMComponentFlagsEnum
  214.  
  215.     ENDIF    ; OLDROUTINENAMES
  216. ;  Location Manager API ---------------------------------------------------------------------------- 
  217.  
  218. ;  The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set... 
  219.  
  220. ;
  221. ; pascal OSErr ALMGetCurrentLocation(SInt16 *index, ALMToken *token, ALMLocationName name)
  222. ;
  223.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  224.         Macro
  225.         _ALMGetCurrentLocation
  226.             move.w              #$0600,D0
  227.             dc.w                $AAA4
  228.         EndM
  229.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  230.         IMPORT_CFM_FUNCTION ALMGetCurrentLocation
  231.     ENDIF
  232.  
  233. ;
  234. ; pascal OSErr ALMGetIndLocation(SInt16 index, ALMToken *token, ALMLocationName name)
  235. ;
  236.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  237.         Macro
  238.         _ALMGetIndLocation
  239.             move.w              #$0501,D0
  240.             dc.w                $AAA4
  241.         EndM
  242.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  243.         IMPORT_CFM_FUNCTION ALMGetIndLocation
  244.     ENDIF
  245.  
  246. ;
  247. ; pascal OSErr ALMCountLocations(SInt16 *locationCount)
  248. ;
  249.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  250.         Macro
  251.         _ALMCountLocations
  252.             move.w              #$0202,D0
  253.             dc.w                $AAA4
  254.         EndM
  255.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  256.         IMPORT_CFM_FUNCTION ALMCountLocations
  257.     ENDIF
  258.  
  259. ;
  260. ; pascal OSErr ALMSwitchToLocation(ALMToken newLocation, ALMSwitchActionFlags switchFlags)
  261. ;
  262.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  263.         Macro
  264.         _ALMSwitchToLocation
  265.             move.w              #$0403,D0
  266.             dc.w                $AAA4
  267.         EndM
  268.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  269.         IMPORT_CFM_FUNCTION ALMSwitchToLocation
  270.     ENDIF
  271.  
  272. ;
  273. ; pascal OSErr ALMRegisterNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  274. ;
  275.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  276.         Macro
  277.         _ALMRegisterNotifyProc
  278.             move.w              #$0404,D0
  279.             dc.w                $AAA4
  280.         EndM
  281.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  282.         IMPORT_CFM_FUNCTION ALMRegisterNotifyProc
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal OSErr ALMRemoveNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  287. ;
  288.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  289.         Macro
  290.         _ALMRemoveNotifyProc
  291.             move.w              #$0405,D0
  292.             dc.w                $AAA4
  293.         EndM
  294.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  295.         IMPORT_CFM_FUNCTION ALMRemoveNotifyProc
  296.     ENDIF
  297.  
  298. ;
  299. ; pascal OSErr ALMConfirmName(ConstStr255Param message, Str255 theName, ALMConfirmChoice *choice, ModalFilterUPP filter)
  300. ;
  301.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  302.         Macro
  303.         _ALMConfirmName
  304.             move.w              #$0806,D0
  305.             dc.w                $AAA4
  306.         EndM
  307.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  308.         IMPORT_CFM_FUNCTION ALMConfirmName
  309.     ENDIF
  310.  
  311. ;  The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set... 
  312.  
  313. ;
  314. ; pascal OSErr ALMPutLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
  315. ;
  316.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  317.         Macro
  318.         _ALMPutLocation
  319.             move.w              #$0B07,D0
  320.             dc.w                $AAA4
  321.         EndM
  322.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  323.         IMPORT_CFM_FUNCTION ALMPutLocation
  324.     ENDIF
  325.  
  326. ;
  327. ; pascal OSErr ALMGetLocation(ConstStr255Param prompt, ALMLocationName name, ModalFilterYDUPP filter, void *yourDataPtr)
  328. ;
  329.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  330.         Macro
  331.         _ALMGetLocation
  332.             move.w              #$0808,D0
  333.             dc.w                $AAA4
  334.         EndM
  335.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  336.         IMPORT_CFM_FUNCTION ALMGetLocation
  337.     ENDIF
  338.  
  339. ;
  340. ; pascal OSErr ALMMergeLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
  341. ;
  342.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  343.         Macro
  344.         _ALMMergeLocation
  345.             move.w              #$0B09,D0
  346.             dc.w                $AAA4
  347.         EndM
  348.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  349.         IMPORT_CFM_FUNCTION ALMMergeLocation
  350.     ENDIF
  351.  
  352.     ENDIF ; __LOCATIONMANAGER__ 
  353.  
  354.